<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@ include file="/WEB-INF/jsp/ResourceGlobal.jsp"%>
<html>

<head>
<!-- 这里引入导航信息header.tpl -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title name="titleName">产品费用与收益信息新增</title>
<style type="text/css">
.panel-input {
	width: 70%;
	float: left;
	margin: 0px 10px;
}

.float-left {
	float: left;
}
</style>
<script type="text/javascript">
	var treFeeDetailPath = '<%=context%>' +'business/treFeeDetail/';
	var treFeeTypePath = '<%=context%>' +'business/treFeeType/';
	var prdFeePath = '<%=context%>' +'business/customerEquity/prdFeeYield/';
	//默认加载
	$(function(){
		//把访问路径传到js
		setPathPrefix(treFeeDetailPath,treFeeTypePath);
		window.treFeeDetail = new TRE_FEE_DETAIL();
	});
</script>
<script type="text/javascript" src="<%=context%>resources/modules/business/product/treFeeDetailView.js?r=<%=Math.random()%>"></script>
</head>

<body class="sub-page">
	<c:if test="${'cpyy' eq type }">
		<jsp:include page="/WEB-INF/jsp/system/index/homeHead.jsp">
			<jsp:param name="currentActive" value="cpyy" />
		</jsp:include>
	
		<div class="location">
			<i class="fas fa-home"></i>
			<p>您现在的位置：主页</p>
			<p class="current">&gt;产品运营</p>
			<p class="current">&gt;产品费用与收益信息</p>
			<p class="current">
				&gt;<span name="titleName">新增</span>
			</p>
		</div>
	</c:if>
	<c:if test="${'cpyy' ne type }">
		<jsp:include page="/WEB-INF/jsp/system/index/homeHead.jsp">
			<jsp:param name="currentActive" value="" />
		</jsp:include>
		<div class="location">
			<i class="fas fa-home"></i>
			<p>您现在的位置：主页</p>
			<p class="current">&gt;招商财富产品线</p>
			<p class="current">&gt;全部产品</p>
			<p class="current">
				&gt;<span name="titleName">新增费率</span>
			</p>
		</div>
	</c:if>
	
	
	<div class="container">
		<div class="page-content">
			<!-- 产品费用与收益信息新建模态窗 -->
			<form id="treFeeDetailAddForm" name="treFeeDetailAddForm" role="form" class="form-horizontal" method="post" action="">
				<!-- 如果将表单禁用，就给fieldset添加disabled属性 -->
				<input type="hidden" name="type" id="type" value="${type }">
				<fieldset>
					<div class="page-content">
						<div class="model">
							<div class="model-head">
								<span class="head-boder-left"></span>
								<h2>产品费用与收益信息</h2>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">产品简称<span class="text-danger">*</span></label>
								<div class="col-sm-10 form-inner">
									<select class="form-control use-select2" placeholder="产品简称" id="subPrdCode" name="subPrdCode"></select>
								</div>
							</div>
						</div>

						<div class="model form-item-group">
							<div class="model-head">
								<span class="head-boder-left"></span>
								<h2>自定义添加费用或收益</h2>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">费用或收益<span class="text-danger">*</span></label>
								<input type="hidden" id="feeType" name="feeType" value="">
								<div class="col-sm-10 form-inner">
									<div class="sub-sel-cont fl" style="padding-top: 8px;">
										<label class="fl">
											<div class="iradio_square-green" name="fee_type" value="fee" onclick="treFeeDetail.chooseFeeType(this);">
												<ins class="iCheck-helper"></ins>
											</div>费用
										</label> 
										<c:if test="${type ne 'cpyy'}">
											<label class="fl">
												<div class="iradio_square-green" name="fee_type" value="yield" onclick="treFeeDetail.chooseFeeType(this);">
													<ins class="iCheck-helper"></ins>
												</div>收益
											</label>
										</c:if>
									</div>
								</div>
							</div>

							<div class="form-group" id="customType" style="display: none;">

								<label class="col-sm-2 control-label" name="customTypeTitle">费用/收益类型<span class="text-danger">*</span></label>

								<div class="col-sm-10 form-inner" name='custom_fee'>
									<select onchange="treFeeDetail.customAddFee()" class='form-control' placeholder="费用类型" id="feeCode" name="feeCode">
										<option value=""></option>
									</select>
								</div>

								<div class="col-sm-10 form-inner" name='custom_yield'>
									<input class="form-control" placeholder="客户收益" value="客户收益" readonly="readonly">
								</div>
							</div>
						</div>

						<div name="show_custom_fee" id="feeContainer" style="display: none;">
							<div class="model form-item-group">
								<div class="model-head">
									<span class="head-boder-left"></span>
									<h2 name="show_custom_fee_title"></h2>
								</div>

								<div class="model-content">
									<div class="form-group">
										<label class="col-sm-2 control-label">费用名称<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="费用名称" id="feeName" name="feeName">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">费率类型<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<select class="form-control use-select2" placeholder="费率类型" name="feeRateType" id="feeRateType" onchange="treFeeDetail.selectFeeRateType();">
												<option value=""></option>
												<wasp:dictOptions dctRootType="FEE_RATE_TYPE" initValue="0"></wasp:dictOptions>
											</select>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">费率（%）<span class="text-danger" id="feeRate_span">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="费率" id="feeRate" name="feeRate">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">年计算天数<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<span class="form-input"> <select class="form-control use-select2" placeholder="年计算天数" name=feeDaysOfYear id="feeDaysOfYear">
													<option value=""></option>
													<wasp:dictOptions dctRootType="FEE_DAYS_OF_YEAR" initValue="0"></wasp:dictOptions>
											</select>
											</span>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">算头算尾</label>
										<input type="hidden" id="isCalEndDayAmount" name="isCalEndDayAmount" value="N">
										<div class="col-sm-10 form-inner">
											<div class="sub-sel-cont fl" style="padding-top: 8px;">
												<label class="fl">
													<div class="iradio_square-green" name="feeIsCalEndDayAmount" value="Y" onclick="treFeeDetail.selectFeeBeginOrEndDate(this);">
														<ins class="iCheck-helper"></ins>
													</div>是
												</label> <label class="fl">
													<div class="iradio_square-green checked" name="feeIsCalEndDayAmount" value="N" onclick="treFeeDetail.selectFeeBeginOrEndDate(this);">
														<ins class="iCheck-helper"></ins>
													</div>否
												</label>
											</div>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">计费起始日<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="计费起始日" id="feeBeginDate" name="feeBeginDate" onchange="treFeeDetail.selectFeeBeginOrEndDate(this);">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">计费结束日<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="计费结束日" id="feeEndDate" name="feeEndDate" onchange="treFeeDetail.selectFeeBeginOrEndDate(this);">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">天数（天）</label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="天数" id="payDeviationDay" name="payDeviationDay" readonly="readonly">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">付费频率<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<select class="form-control use-select2" placeholder="付费频率" name="feeFrequency" id="feeFrequency">
												<option value=""></option>
												<wasp:dictOptions dctRootType="FEE_FREQUENCY"></wasp:dictOptions>
											</select>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">首次支付日<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="首次支付日" id="feePayDateFirst" name="feePayDateFirst">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">计费本金<span class="text-danger" id="feePrincipal_span">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="计费本金" id="feePrincipal" name="feePrincipal">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">费用总金额<span class="text-danger" id="feeAggregateAmouunt_span" style="display: none;">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="费用总金额" id="feeAggregateAmouunt" name="feeAggregateAmouunt" readonly="readonly">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">费率备注</label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="费率备注" id="feeRateRemark" name="feeRateRemark">
										</div>
									</div>
<!-- 									<div class="form-group"> -->
<!-- 										<label class="col-sm-2 control-label">标的简称<span class="text-danger">*</span></label> -->
<!-- 										<div class="col-sm-10 form-inner"></div> -->
<!-- 									</div> -->
<!-- 									<div class="form-group"> -->
<!-- 										<label class="col-sm-2 control-label">税后费率（%）<span class="text-danger">*</span></label> -->
<!-- 										<div class="col-sm-10 form-inner"> -->
<!-- 											<input class="form-control" placeholder="税后费率" id="atFeeRate" name="atFeeRate"> -->
<!-- 										</div> -->
<!-- 									</div> -->
								</div>
							</div>
							<div class="form-item-group" id="floatFeeRate" style="display: none;">
								<input type="hidden" id="feeChangeListJson" name="feeChangeListJson"/>
								<div class="model-head">
									<span class="head-boder-left"></span>
									<h2>费率变动</h2>
								</div>
								<div class="model-content" id="floatFeeRateType">
									<div class="jqGrid_wrapper fullscreen-wrapper">
										<table id="feeChangeList"></table>
										<div id="feeChangeListPage"></div>
									</div>
								
									<!-- <div class="form-group">
										<label class="col-sm-2 control-label">起期日<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="起始日期" id="rateBeginDate" name="rateBeginDate">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">止息日<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="停止日期" id="rateEndDate" name="rateEndDate">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">费率（%）<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="费率" id="floatFeeRate" name="floatFeeRate">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">税后费率（%）<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="费率" id="atFeeRate" name="atFeeRate">
										</div>
									</div> -->
								</div>
							</div>
						</div>
						
						<div name="show_custom_yield" id="yieldContainer" style="display: none;">
							<div class="model form-item-group">
								<div class="model-head">
									<span class="head-boder-left"></span>
									<h2>客户收益</h2>
								</div>

								<div class="model-content">
									<div class="form-group">
										<label class="col-sm-2 control-label">收益名称<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="收益名称" id="yieldName" name="yieldName">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">业绩比较基准类型<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<select class="form-control use-select2" placeholder="业绩比较基准类型" name="yieldType" id="yieldType" onchange="treFeeDetail.selectYieldRateType();">
												<option value=""></option>
												<wasp:dictOptions dctRootType="FEE_RATE_TYPE"></wasp:dictOptions>
											</select>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">业绩比较基准（%）<span class="text-danger" id="yield_span">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="业绩比较基准" id="yield" name="yield">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">年计算天数<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<span class="form-input"> <select class="form-control use-select2" placeholder="年计算天数" name=calDaysOfYear id="calDaysOfYear">
													<option value=""></option>
													<wasp:dictOptions dctRootType="FEE_DAYS_OF_YEAR" initValue="0"></wasp:dictOptions>
											</select>
											</span>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">算头算尾<span class="text-danger">*</span></label>
										<input type="hidden" id="yIsCalEndDayAmount" name="yIsCalEndDayAmount" value="N">
										<div class="col-sm-10 form-inner">
											<div class="sub-sel-cont fl" style="padding-top: 8px;">
												<label class="fl">
													<div class="iradio_square-green" name="yieldIsCalEndDayAmount" value="Y" onclick="treFeeDetail.selectFeeBeginOrEndDate(this);">
														<ins class="iCheck-helper"></ins>
													</div>是
												</label> <label class="fl">
													<div class="iradio_square-green checked" name="yieldIsCalEndDayAmount" value="N" onclick="treFeeDetail.selectFeeBeginOrEndDate(this);">
														<ins class="iCheck-helper"></ins>
													</div>否
												</label>
											</div>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">计息起始日<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="计息起始日" id="yieldInteBgnDate" name="yieldInteBgnDate" onchange="treFeeDetail.selectFeeBeginOrEndDate(this);">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">计息结束日<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="计息结束日" id="yieldInteEndDate" name="yieldInteEndDate" onchange="treFeeDetail.selectFeeBeginOrEndDate(this);">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">天数（天）<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="天数" id="yield_payDeviationDay" name="yield_payDeviationDay" readonly="readonly">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">分配频率<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<select class="form-control use-select2" placeholder="分配频率" name="yieldPayRate" id="yieldPayRate">
												<option value=""></option>
												<wasp:dictOptions dctRootType="FEE_FREQUENCY"></wasp:dictOptions>
											</select>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">首次支付日<span class="text-danger">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="首次支付日" id="interestPayDateFirst" name="interestPayDateFirst">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">计息本金<span class="text-danger" id="interestPrincipal_span">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="计息本金" id="interestPrincipal" name="interestPrincipal">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">收益总金额<span class="text-danger" id="yieldAggregateAmouunt_span">*</span></label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="收益总金额" id="yieldAggregateAmouunt" name="yieldAggregateAmouunt">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">业绩比较基准备注</label>
										<div class="col-sm-10 form-inner">
											<input class="form-control" placeholder="业绩比较基准备注" id="yieldRemark" name="yieldRemark">
										</div>
									</div>
								</div>
							</div>
							<div class="form-item-group" id="floatYieldRate" style="display: none;">
							<input type="hidden" id="yieldChangeListJson" name="yieldChangeListJson"/>
								<div class="model-head">
									<span class="head-boder-left"></span>
									<h2>业绩比较基准变动</h2>
								</div>
								<div class="model-content" id="floatYieldFeeRateType">
									<div class="jqGrid_wrapper fullscreen-wrapper">
										<table id="yieldFeeChangeList"></table>
										<div id="yieldFeeChangeListPage"></div>
									</div>
								</div>
							</div>
						</div>

						<div class="page-footer">
							<button type="button" class="btn btn-primary btn-save btn-loading btn-w-xs" id="commitBtn" name="commitBtn" data-loading-text="<i class='ico-loading'></i>" onclick="treFeeDetail.addTreFeeDetail();">提交</button>
							<button type="button" class="btn btn-link btn-w-xs" id="cancelBtn" name="cancelBtn" onclick="window.close();">取消</button>
						</div>
					</div>
				</fieldset>
			</form>
		</div>
	</div>
</body>